import time
from zhcxgd_can import zhcxgd_can,Remote

def test():
    can = zhcxgd_can()
    dev = can.FindUsbDevice()
    print(dev)
    # can.open()
    # can.UsbDeviceReset()
    # time.sleep(10)
    can.open()
    can.ReadBoardInfo()
    channel = can.InitCAN(can.CHANNEL1,BaudRate=can.BAUDRATE_250K)
    channel.ResetCAN()
    channel.StartCAN()
    channel.ClearBuffer();
    channel.setRemote(Remote(0x1860FFD2,0,2))
    
    for i in range(10):
        #input("wait...")
        n = channel.Transmit(b'\x00\x00\x00\x00\x00\x00\x00\x00')
        print(n)
        time.sleep(1)
        channel.print_recive()
    can.close()


if __name__ == "__main__":
    test()
